package com.jr.service.impl;

import com.jr.mapper.ProgramMapper;
import com.jr.mapper.UserMapper;
import com.jr.pojo.PUser;
import com.jr.pojo.Program;
import com.jr.pojo.User;
import com.jr.service.ProgramService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class ProgramServiceImpl implements ProgramService {

    @Autowired
    private ProgramMapper mapper;
    
    @Autowired
    private UserMapper userMapper;

    @Override
    public User queryByUser(User user) {
        User foundUser = userMapper.selectByUsername(user.getUsername());
        if (foundUser != null && foundUser.getPassword().equals(user.getPassword()) && "active".equals(foundUser.getStatus())) {
            return foundUser;
        }
        return null;
    }

   /* @Override
    public PUser queryByPUser(PUser pu) {
        return mapper.selectByPUser(pu);
    }

    @Override
    public ArrayList<Program> queryByProgram( Program program, Integer pageIndex, Integer showNum) {
        return mapper.selectByProgram(program,pageIndex,showNum);
    }

    @Override
    public int selectAll(Program program) {
        return mapper.selectAll(program).size();
    }

    @Override
    public boolean updateStatus(Program p) {
        return mapper.updateStatus(p)>0;
    }
*/

}
